import {lazy} from 'react'
import { FriendsO, HomeO, Search, SettingO } from '@react-vant/icons'
import { Navigate } from 'react-router-dom'

let Home=lazy(()=>import('../page/home/Index'))
let Mylayout=lazy(()=>import('../page/mylayout/Index'))
let My=lazy(()=>import('../page/my/Index'))
let Message=lazy(()=>import('../page/message/Index'))
let Order=lazy(()=>import('../page/order/Index'))

// 一级路由
export const homeRoutes=[
    {
        path:'/home',
        element:<Home></Home>,
        title:'首页',
        icon:<HomeO />
    },
    {
        path:'/order',
        element:<Order></Order>,
        title:'订单',
        icon:<SettingO />
    },
    {
        path:'/message',
        element:<Message></Message>,
        title:'消息',
        icon:<Search />
    },
    {
        path:'/my',
        element:<My></My>,
        title:'我的',
        icon:<FriendsO />
    },
]

export const routes=[
    {
        path:'/',
        element:<Mylayout></Mylayout>,
        children:[
            ...homeRoutes,
            {
                path:'/',
                element:<Navigate to='/home'></Navigate>
            }
        ]
    },
]